package com.tuanbiao.models.action;

import com.hzjq.data.callback.Callback;
import com.hzjq.data.callback.OnResultVoltageElectricProgressCallback;
import com.hzjq.lib.BlastKool;
import com.hzjq.lib.cap.bean.CommResult;
import com.tuanbiao.data.callback.OnBaseResultCallback;

import timber.log.Timber;

/**
 * @author abiao
 * @since 2022/4/29 11:13
 */
public interface ChargeAction {
    default void charge(OnResultVoltageElectricProgressCallback<CommResult> callback) {
        BlastKool.Companion.loader().charge().charge(callback);
    }

    default void exitCharge(OnBaseResultCallback<Boolean> callback) {
        Timber.i("exitCharge");
        BlastKool.Companion.loader().charge().exit(new Callback<Boolean>() {
            @Override
            public void run(Boolean aBoolean) {
                callback.onSuccess(aBoolean);
                callback.onFinish();
            }
        });
    }

    default void cancelCharge() {
        Timber.i("cancelCharge");
        BlastKool.Companion.loader().charge().cancel();
    }

}
